home *** CD-ROM | disk | FTP | other *** search
/ The CICA Windows Explosion! / The CICA Windows Explosion! - Disc 1.iso / games / worm.zip / WORMMAIN.C < prev    next >
C/C++ Source or Header  |  1992-09-20  |  1KB  |  76 lines

  1.  
  2.  
  3. #include "worm.h"
  4.  
  5. HANDLE hInst;
  6.  
  7. /* ------------------------------------------------------------------------------ */
  8.  
  9. int PASCAL WinMain(HANDLE hInstance, HANDLE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
  10. {
  11. HWND hWnd;
  12. MSG msg;
  13.  
  14.  
  15. /* Make sure that the program is running under a 32bit CPU */
  16. if ((GetWinFlags() & WF_CPU286)) {
  17.      ErrorBox("This program can only be run under a 32bit CPU!");
  18.      return(NULL);
  19. }
  20. if(hPrevInstance) {
  21.     ErrorBox("Your screen is already wormed!");
  22.     return(NULL);
  23. }
  24.  
  25. if(!WormInit(hInstance)) {
  26.    ErrorBox("Class registration failed!");
  27.    return(NULL);
  28. }
  29.  
  30. hInst = hInstance;
  31.  
  32. hWnd = CreateWindow(
  33.       WORM_APPNAME,
  34.       WORM_TITLE,
  35.       WS_OVERLAPPEDWINDOW,
  36.       CW_USEDEFAULT,
  37.       CW_USEDEFAULT,
  38.       0,
  39.       0,
  40.       NULL,
  41.       NULL,
  42.       hInstance,
  43.       NULL
  44.       );
  45.  
  46.  
  47. if(!hWnd) {
  48.    ErrorBox("Could not create window!");
  49.    return (NULL);
  50. }
  51.  
  52.  
  53. if(!GetScreenSize()) {
  54.    ErrorBox("Could not obtain screen handle!");
  55.    return(NULL);
  56. }
  57.  
  58. if(!SetTimer(hWnd, NULL, 1000 / GetSpeed(), NULL) ) {
  59.    ErrorBox("No timers available!");
  60.    return(NULL);
  61. }
  62.  
  63. ShowWindow(hWnd, SW_MINIMIZE);
  64. UpdateWindow(hWnd);
  65.  
  66. while( GetMessage( &msg, NULL, NULL, NULL) ) {
  67.    TranslateMessage(&msg);
  68.    DispatchMessage(&msg);
  69. }
  70. return(msg.wParam);
  71.  
  72. } /* WinMain */
  73.  
  74. /* EOF */
  75.  
  76.